package PenguinsFarm
{
	import Interfaces.PenguinsFarm.MICageBackground;
	import Interfaces.PenguinsFarm.MIPenguinsFarmView;
	
	import PenguinsFarm.Penguins.PenguinsEntity;
	import PenguinsFarm.Penguins.PenguinsRenderer;
	import PenguinsFarm.Renderer.CageBackground;
	
	import XMFramework.Core.SCore;
	import XMFramework.Interface.Architechture.SMView;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	
	public class PenguinsFarmView extends SMView implements MIPenguinsFarmView
	{
		private var cageBackground : MICageBackground;
		public var penguinsRenderList:Vector.<PenguinsRenderer> = new Vector.<PenguinsRenderer>();
		
		public function PenguinsFarmView()
		{
			super();
		}
		
		override public function onRegisterCompleted():void
		{
			Global.CoreSNSFramework = coreSNSFramework;
			
			var host : DisplayObjectContainer	=	
				coreSNSFramework.globalHolder.getVariable( ShareMacros.VAR_GAME_CONTAINER ) as DisplayObjectContainer;
			setSize( host.width, host.height );
			setParentContainer( host );
		}
		
		public function onInit(initData:Object):Boolean
		{
			cageBackground	=	new CageBackground();
			addChild( cageBackground as CageBackground );
			
			coreSNSFramework.getStage().addEventListener( KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void
			{
				switch( e.keyCode )
				{
					case Keyboard.SPACE:
						//Global.viewsCab.showLayer( ShareMacros.MV_IBShop, true );
						break;
				} 
			});
			
			return true;
		}
		
		public function onResize():void
		{
			cageBackground.onResize();
		}
		
		public function getCageBackground():MICageBackground
		{
			return cageBackground;
		}
	}
}